<?php
namespace app\common\model;
class Taskfunc extends Base{
    /**
     * 获取功能组下的属性
     * @param  integer $func_id 功能组ID
     * @param  array   $where 额外的条件
     * @return array
     */
    function getParamsIds($func_id=0,$where=[]){
        if($func_id<=0||empty($func_id)){
            return [];
        }
        $_where=[
            'func_id'=>$func_id
        ];
        if(is_array($func_id)){
            $_where=[
                'func_id'=>['func_id','in',$func_id]
            ];
        }
        $map=array_merge($where,$_where);
        $list=model('func_pamams')->readAll($map,0,['field'=>'params_id']);
        $ids=[];
        foreach ($list as $v) {
            $ids[]=$v['params_id'];
        }
        $ids=array_unique($ids);
        return $ids;
    }
    
    function taskparams(){
        return $this->belongsToMany('taskparams','func_pamams','params_id','func_id');
    }
}
